<?php
class ModuleSnsModel extends SzMySqlModel
{

    /**
     * @see SzAbstractModel::$ORM_NAME
     * @var string
     */
    public static $ORM_NAME = 'ModuleSns';

    /**
     * Initialize the ModuleSnsModel.
     *
     * @return ModuleSnsModel
     */
    public function __construct()
    {
        $this->table = 'module_sns';
        $this->columns = array('platformId', 'userId', 'created', );
        $this->autoIncrColumn = 1;
        $this->diffUpColumns = array();
        $this->updateFilter = array();
        $this->toArrayFilter = array();
        $this->searchColumns = array(0, 1, );
        $this->updateColumns = array(0, );
        $this->jsonColumns = array();
        $this->cacheColumn = 0;
        $this->shardColumn = null;
        $this->pkColumn = 0;
        $this->deleteColumns = array(0, );
        $this->tableShardCount = null;
        $this->cacheTime = null;

        $this->ormName = 'ModuleSns';
        $this->columnCount = 3;
        $this->isList = false;
        $this->dbType = 'MySql';
        $this->voClassName = 'ModuleSnsVo';
        $this->voListClassName = 'ModuleSnsVoList';

        parent::__construct();
    }

    /**
     * Prepare SzAbstractDb & SzDbQueryBuilder.
     *
     * @param string $shardKey
     * @return array
     * <pre>
     * array(
     *     SzAbstractDb,
     *     SzDbQueryBuilder
     * )
     * </pre>
     */
    protected function prepareQueryHandles($shardKey)
    {
        $dbHandle = null;
        if (method_exists($this->context, 'getMasterDb')) {
            $dbHandle = $this->context->getMasterDb();
        }
        if (is_null($dbHandle)) {
            return parent::prepareQueryHandles($shardKey);
        }
        $queryBuilder = $this->context->getQueryBuilder();

        return array($dbHandle, $queryBuilder);
    }
}